#ifndef _P2D_FORCE_ATTRACTOR_H_
#define _P2D_FORCE_ATTRACTOR_H_

#include "p2d_force.h"

namespace part2d
{

/**
* @brief provide a force that 
*
* This force can be used for wind, gravity, etc. 
*/
class P2DForceAttractor : public P2DForce
{
public:
    enum AttractorType
    {
        Constant,
        Linear,
        InvLinear,
        InvSqr
    };
    /**
    * Initialize class
    */
                    P2DForceAttractor();
    /**
    * Destroy class
    * force it to be instantiated
    */
    virtual         ~P2DForceAttractor();

    /**
    * Load settings for particle force from LUA Object
    * @param    _LObj     Lua Table to load from
    */
    virtual bool    Load(LuaPlus::LuaObject& _LObj);

    /**
    * Render a visual representation of this force
    */
	virtual bool	RenderDebug(const math::Vec2& GroupCenter);

    /**
    * Update all active particles in this set
    */
    virtual	bool	MoveParticles(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);

    /**
    * Clone ourselves
    */
	virtual P2DForce*	Clone();


protected:
    math::Vec2      m_Offset;       // Position relative to group
    AttractorType   m_Type;         // type of attraction 
    float           m_Magnitude;    // strength of attraction

private:
    bool            MoveConst(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    bool            MoveLinear(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    bool            MoveInvLinear(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);
    bool            MoveInvSquare(const math::Vec2& GroupCenter, Particle2D* _Particles, unsigned int _usCount, float dt);

};

};

#endif //_P2D_FORCE_ATTRACTOR_H_